function fib(n:number) : number {
    return n<=1 ? n: fib(n-1)+fib(n-2);
}
let nums:number[] = [0,1]
function fibTopBottom(n:number):number {
    return n<=1 ? n : nums[n] ||  (nums[n] = fibTopBottom(n-1) + fibTopBottom(n-2));
}

function fibBottomUp(n:number):number {
    let nums:number[] = [0,1]
    for(let i = 2; i<n;i++){
        nums[i] = nums[i-1] + nums[i-2]
    }
    console.log(nums)
    return nums[n];
}
